package org.adorsys.aderp.om.domain;

import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.validation.constraints.NotNull;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.entity.RooJpaEntity;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaEntity
public class RnItem {

    @NotNull
    @Column(name = "rnItemKeyBk", unique = true)
    private String rnItemKey;

    private String itemNumber;

    @NotNull
    @ManyToOne
    private ProductRef productRef;

    @NotNull
    private BigDecimal qty;

    @NotNull
    private BigDecimal unitPrice;

    @NotNull
    private BigDecimal amount;

    private String itemDesc;

    @ManyToOne
    private ReturnNote returnNote;

    @ManyToOne
    private ItemState itemState;

    @NotNull
    @ManyToMany(cascade = CascadeType.ALL)
    private Set<SalesOrder> salesOrders = new HashSet<SalesOrder>();

    @NotNull
    @ManyToMany(cascade = CascadeType.ALL)
    private Set<Invoice> invoices = new HashSet<Invoice>();

    private String recordOwner;
}
